#ifndef SYSTEM_H
#define SYSTEM_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

extern uint32_t SystemCoreClock;
extern volatile uint32_t System_delayTick;
extern uint32_t _rom_base;


typedef enum {
    FALSE = 0,
    TRUE
}BOOL_T;

typedef enum {
    /* AHB Peripheral. */
    CLK_DMA1 = 0,
    CLK_DMA2 = 1,
    CLK_SRAM = 2,
    CLK_FPU = 3,
    CLK_FMC = 4,
    CLK_QSPI = 5,
    CLK_CRC = 6,
    CLK_EMMC = 8,
    CLK_SDIO = 10,
    CLK_OTG_FS = 12,
    CLK_ETH_MAC = 14,
    CLK_ETH_MAC_TX = 15,
    CLK_ETH_MAC_RX = 16,
    /* APB1 Peripheral. */
    CLK_TMR2 = 0 + 32,
    CLK_TMR3 = 1 + 32,
    CLK_TMR4 = 2 + 32,
    CLK_TMR5 = 3 + 32,
    CLK_TMR6 = 4 + 32,
    CLK_TMR7 = 5 + 32,
    CLK_WWDT = 11 + 32,
    CLK_SPI2 = 14 + 32,
    CLK_SPI3 = 15 + 32,
    CLK_USART2 = 17 + 32,
    CLK_USART3 = 18 + 32,
    CLK_UART4 = 19 + 32,
    CLK_UART5 = 20 + 32,
    CLK_I2C1 = 21 + 32,
    CLK_I2C2 = 22 + 32,
    CLK_USB = 23 + 32,
    CLK_CAN1 = 25 + 32,
    CLK_CAN2 = 26 + 32,
    CLK_BAKR = 27 + 32,
    CLK_PMU = 28 + 32,
    CLK_DAC = 29 + 32,
    /* APB2 Peripheral. */
    CLK_AFIO = 0 + 64,
    CLK_GPIOA = 2 + 64,
    CLK_GPIOB = 3 + 64,
    CLK_GPIOC = 4 + 64,
    CLK_GPIOD = 5 + 64,
    CLK_GPIOE = 6 + 64,
    CLK_ADC1 = 9 + 64,
    CLK_ADC2 = 10 + 64,
    CLK_TMR1 = 11 + 64,
    CLK_SPI1 = 12 + 64,
    CLK_TMR8 = 13 + 64,
    CLK_USART1 = 14 + 64,
    CLK_ADC3 = 15 + 64,

}PeripheralClock_t;

void System_setPeripheralClockEnable(PeripheralClock_t clock,BOOL_T status);

void System_delayUs(int nus);
void System_delayMs(int nms);

#ifdef __cplusplus
}
#endif

#endif